﻿using System;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Xml.Linq;


namespace LibraryWinService
{
    public class DatabaseAccess
    {
        String connectionString = "Data Source=OLSON140SERVER;Initial Catalog=BPI_Library;Integrated Security=True";

        public DatabaseAccess()
        {
            //
            // TODO: Add constructor logic here
            //
        }

        //gets reserved books that are ready to pick up
        //Kayla
        public DataSet getReservedBooksToNotify()
        {
            SqlConnection con = new SqlConnection(connectionString);
            con.Open();
            SqlDataAdapter command = new SqlDataAdapter("exec RESERVEDBOOK_Select_ToNotify", con);
            con.Close();
            DataSet ds = new DataSet();
            command.Fill(ds);
            return ds;
        }
        //gets overdue books 
        //Kayla
        public DataSet getOverdueBooksToNotify()
        {
            SqlConnection con = new SqlConnection(connectionString);
            con.Open();
            SqlDataAdapter command = new SqlDataAdapter("exec CHECKEDOUTBOOK_Select_Overdue", con);
            con.Close();
            DataSet ds = new DataSet();
            command.Fill(ds);
            return ds;
        }
        //gets books due soon 
        //Kayla
        public DataSet getBooksDueSoonToNotify()
        {
            SqlConnection con = new SqlConnection(connectionString);
            con.Open();
            SqlDataAdapter command = new SqlDataAdapter("exec CHECKEDOUTBOOK_Select_DueSoon 2", con);
            con.Close();
            DataSet ds = new DataSet();
            command.Fill(ds);
            return ds;
        }
    }
}
